<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const str = "abcdefg";

      console.log("substr(1, 3)", str.substr(1, 3));
      console.log("substr(1)", str.substr(1));
      console.log("substr(-3)", str.substr(-3));
      console.log("substr(-3,2)", str.substr(-3, 2));

      /* const str = {
        0: "a", -7
        1: "b", -6
        2: "c", -5
        3: "d", -4
        4: "e", -3
        5: "f", -2
        6: "g", -1
      }; */
    </script>
  </body>
</html>
